package com.example.controller;


import org.apache.dubbo.config.annotation.DubboReference;
import org.example.model.Student;
import org.example.service.studentService;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class studentController {
    @DubboReference(interfaceClass = org.example.service.studentService.class)
    private studentService studentService;

    @RequestMapping("/getStudents")
    public @ResponseBody Object getAllStudents(){
        List<Student> allStudents = studentService.getAllStudents();
        return "通过Dubbo获取数据："+allStudents;
    }
}
